/**
 * VUEshop
 * ============================================================================
 * * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.vueshop.com.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: 沈小白 2020-07-22 $
 */<template> 
    <view>
        <view class="wrap">
            <view class="reset">
                <view class="reset-box">
                    <view class="label">重置密码：</view>
                    <input type="text" v-model="pass_word">
                </view>
                <image :src="imgUrl+'common/gray_close.png'" class="close" @tap="clearMobile" v-if="isFlag"></image>
            </view>
            <view class="submit" :class="[isFlag?'submit-select':'']" @tap="submitPwd">提交</view>
        </view>
    </view>
</template>
<script>
import config from "@/api/config";
import common from "@/common/common";
import Md from "md5";
import passwordMixin from "@/mixin/forgotPassword.js";
export default {
    mixins: [passwordMixin],
    data() {
        return {
            pass_word:"",
            code:"",
            imgUrl:config.imgUrl,
            mobile:"",
        }
    },
    onLoad(options){
        console.log(options);
        this.code=options.code;
        this.mobile=options.mobile;
    },
    computed: {
        isFlag(){
            if(this.pass_word.length>0){
                return true
            }else{
                return false
            }
        }
    },
    methods: {
        clearMobile(){
            this.pass_word=""
        },
        /*提交密码*/ 
        submitPwd(){
            let passwordFlag=common.VerifyPassword(this.pass_word);
            if(!passwordFlag){
                return false
            }
            let password=Md("TPSHOP"+this.pass_word)
            console.log(this.mobile)
            console.log(password)
            let params={
                mobile:this.mobile,
                verification:this.code,
                pass_word:password,
            }
            let url="/pages/user/login/login"
            this.forgotPassword(params,url)
        },
    },
}
</script>
<style lang="scss">
    page{
        background: #fff;
    }
    .wrap{
        margin: 60rpx 70rpx 0;
        .reset{
            position: relative;
             padding: 36rpx 0;
            border-bottom: 1px solid #E6E6E6;
        }
        .reset-box{
           
            display: flex;
            flex-direction: row;
            align-items: center;
            
            .label{
                color: #333;
                font-size: 30rpx;
                margin-left: 33rpx;
            }
            input{
                color: #333;
                font-size: 36rpx;
            }
        }
        .close{
            position: absolute;   
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 36rpx;
            height: 36rpx;
            border-radius: 50%;
        }
        .submit{
            width:610rpx;
            height:90rpx;
            line-height: 90rpx;
            background:rgba(204,204,204,1);
            border-radius:45px;
            color: #fff;
            font-size: 30rpx;
            line-height: 90rpx;
            text-align: center;
            margin-top: 100rpx;
        }
        .submit-select{
            background:linear-gradient(90deg,rgba(255,59,59,1) 0%,rgba(255,93,61,1) 100%);
        }
    }
</style>